home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9658 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Segmentation Fault ???
  5. Date: 10 Mar 96 20:26:58 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.826489618@rscernix>
  8. References: <4hsa7i$en3@wraith.its.uow.edu.au> <4huis1$cm2@ccshst05.cs.uoguelph.ca>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4huis1$cm2@ccshst05.cs.uoguelph.ca> thay@uoguelph.ca (Toby K Hay) writes:
  13.  
  14. >Theeradech Paopeng (tp02@wraith.its.uow.edu.au) wrote:
  15. >: Hello to all.
  16. >:     I'm here to ask you guys about the "Segmentation Fault". 
  17. >: I was run my program on Unix and I got run_time_error say that "Segmentation
  18. >: Fault". I really no idea how to fix that problem. One more thing I have to tell to fix that problem. One more thing I have to tell
  19.  
  20. This is a typical case of doing bad things with pointers, most likely
  21. dereferencing an uninitialized pointer.
  22.  
  23. >This is a coincidence.  I moved a running ANSI C program from Turbo C on 
  24. >my PC to a multi-processor Silicon Graphics UNIX machine yesterday (my 
  25. >first try at running C on anything but a PC) and got the same error.  
  26. >Retrying invoked a "Bus Error".  I assumed that my abysmal ingnorance of 
  27. >UNIX was causing me to omit essential switches from the command line or 
  28. >something of that nature, and resolved to ask on an SGI newsgroup, and to 
  29. >ask the system administrator for guidance after the weekend.  
  30.  
  31. Another case of doing bad things with pointers.  On PC, there are no
  32. alignment restrictions, on most other architectures an attempt to access
  33. data which is not properly aligned will cause an Bus Error and a coredump.
  34. Learn how to use a debugger to analize a coredump and you'll find out
  35. your problem instantly.
  36.  
  37. There is nothing SGI-specific in your problem and no compiler switches
  38. will help.  You have to fix your program.
  39.  
  40. Dan
  41. --
  42. Dan Pop
  43. CERN, CN Division
  44. Email: danpop@mail.cern.ch 
  45. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  46.